package com.omega.encryptedsql.po;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.omega.encryptedsql.handler.SmartEncryptTypeHandler;
import com.omega.encryptedsql.annotation.SensitiveField;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author omega
 * @description: TODO
 * @date 2025/7/10
 */
@Data
@TableName(value = "t_employee", autoResultMap = true)
public class Employee {

    @TableId(type = IdType.AUTO)
    private Long id;

    @SensitiveField(enabled = false) // 标记但禁用加密
    @TableField(typeHandler = SmartEncryptTypeHandler.class)
    private String name;

    private Integer age;

    @SensitiveField(keyId = "personal")
    @TableField(typeHandler = SmartEncryptTypeHandler.class)
    private String email;

    @SensitiveField(keyId = "personal")
    @TableField(typeHandler = SmartEncryptTypeHandler.class)
    private String phone;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
